<%--
  Created by IntelliJ IDEA.
  User: 陌·笙
  Date: 2019-01-15
  Time: 14:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>一周趋势</title>
    <jsp:include page="/comm/tag.jsp"/>
</head>
<body>
<div style="margin-left: 50px;margin-right: 50px; padding-top: 50px ">
    <div class="col-md-12">
        <div id="main" style="height:400px;padding-top: 50px"></div>
    </div>
    <script>
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        //设置等待图
        myChart.showLoading();
        option = {
            title : {
                text: '最近一周的销售量',
                subtext: '详情',
                x:'center'
            },
            xAxis: {
                type: 'category',
                data: []
            },
            yAxis: {
                type: 'value'
            },
            tooltip : {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            series: [{
                data: [],
                type: 'line'
            }]
        };
        myChart.setOption(option);
        $.post('/tongji/times',function (data){
            var name=data.xq;
            var count =data.count;
            myChart.setOption({
                xAxis: {
                    data: name
                },
                series: [{
                    // 根据名字对应到相应的系列
                    name: '数量',
                    type: 'line',
                    data: count
                }]
            });
            //隐藏等待图
            myChart.hideLoading();
        }) ;
    </script>
</div>
</body>
</html>
